#!/usr/bin/env python
# encoding: utf-8
"""
misc_Test.py

Created by Orestis Markou on 2007-12-12.
Copyright (c) 2007 Orestis Markou. All rights reserved.
"""

import unittest
from greeklish import greeklishout


class misc_Test(unittest.TestCase):
    def setUp(self):
        pass
        
    def test_mask_from_word(self):
        orig = 'OrRss'
        mask = greeklishout.mask_from_case(orig)
        self.assertEqual(mask,[True,False,True,False,False])
    
    def test_word_from_mask(self):
        mask = [True, False, True, True, True]
        word = greeklishout.case_from_mask('oress', mask)
        self.assertEqual(word, 'OrESS')
        
    def test_each_word_with_mask(self):
        """docstring for test_each_word_with_mask"""
        text = 'Hi! Test words.'
        res = [(word, mask, original) for word, mask, original in  greeklishout.each_word_with_mask(text)]
        self.assertEqual(res[0], ('hi',[True, False], 'Hi'))
        self.assertEqual(res[1], (None, None,'!'))
        self.assertEqual(res[2], (None, None,' '))
        self.assertEqual(res[3],('test', [True,False,False,False], 'Test'))
        self.assertEqual(res[4],(None,None, ' '))
        self.assertEqual(res[5],('words', [False]*5,'words'))
        self.assertEqual(res[6],(None,None,'.'))

        

    
if __name__ == '__main__':
    unittest.main()